﻿using System;
using System.Collections.Generic;
using System.Data.Linq;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using DbLibrary;

namespace DbLibrary.DataBase
{
    public class ReportPeriodRepository : RepositoryBase<Models.ReportPeriod, ReportPeriod>
    {
        protected override Table<ReportPeriod> GetTable()
        {
            return context.ReportPeriods;
        }

        protected override Expression<Func<ReportPeriod, Models.ReportPeriod>> GetConverter()
        {
            return c => new Models.ReportPeriod()
            {
                Id = c.Id,
                Name = c.Name,
                Comments = c.Comments,
                Test = c.Test
            };
        }

        protected override void UpdateEntry(ReportPeriod dbReportPeriod, Models.ReportPeriod reportPeriod)
        {
            dbReportPeriod.Name = reportPeriod.Name;
            dbReportPeriod.Comments = reportPeriod.Comments;
            dbReportPeriod.Test = reportPeriod.Test;
        }
    }
}
